﻿
using System;
using System.Collections.Generic;
using WinScriptEngine.Parses.Interface;

namespace WinScriptEngine.Parses
{
    /// <summary>
    /// 元数据类型
    /// </summary>
    [Flags()]
    internal enum MetadataType
    {
        Null    = 1 << 0,
        Value   = 1 << 1,
        Symbol  = 1 << 4,
        Oper    = 1 << 5,
        Ctrl    = 1 << 6,
        Func    = 1 << 7,
        String  = 1 << 8,
    }
    /// <summary>
    /// 元数据结构。
    /// </summary>
    class Metadata
    {
        /// <summary>
        /// 解析后的元数据。
        /// </summary>
        /// <param name="type">元数据类型</param>
        /// <param name="object">元数据表述的值</param>
        /// <param name="parser">元数据对应的解析器，仅在解析<see cref="Scope.InvokeEnvironment.instructions"/>处有用</param>
        public Metadata(Parses.MetadataType type, dynamic @object, IParse parser = null)
        {
            this.type = type;
            this.@object = @object;
            this.parser = parser;
        }
        /// <summary>
        /// 元数据类型
        /// </summary>
        public Parses.MetadataType type { get; set; }
        /// <summary>
        /// 元数据表述的值
        /// </summary>
        public dynamic @object { get; set; }
        /// <summary>
        /// 元数据对应的解析器
        /// </summary>
        public IParse parser { get; set; }

    }
}